Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
MongoDB "update()" (Update the document of “Reg Rubio” and “Ian Tayao” by adding the “President” to their Reporting file)

I use this codes manually

db.employees.update({Name: "Reg Rubio"}, {$set : {ReportingTo: ["Vice-President", "President"]}})

db.employees.update({Name: "Ian Tayao"}, {$set : {ReportingTo: ["Secretary", "Vice-President", "President"]}}) 

to update my data. Is their other way to to combine this in one function?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

So.. no.. , there is no way to update two separate documents using an 2 different inputs in 1 db call.

To optimize network traffic you can use bulkWrite, this still executes each update separately in the db but it only sends the request over network once, reducing the overhead for all the traffic. This is the only optimization you can add and for only 2 calls I would say it's somewhat negligent.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda